package ${servicePackage}.repository.impl;

import cn.hutool.core.collection.CollectionUtil;
import ${pojoPackage}.entity.${className};
import ${servicePackage}.mapper.${className}Mapper;
import ${servicePackage}.repository.in.${className}Repository;
import ${corePackage}.repository.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
<#if isServerEntity>
    import ${pojoPackage}.dto.${classOtherName}.*;
    import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
</#if>

/**
* 【描 述】：
* 【环 境】：J2SE
* 【详 细】：
*
*/
@Service
public class ${className}RepositoryImpl extends Repository< ${className}Mapper , ${className}> implements ${className}Repository {

private final ${className}Mapper mapper;

public ${className}RepositoryImpl(${className}Mapper mapper) {
this.mapper = mapper;
}

<#if isServerEntity>
    /**
    * 搜索${entityName}
    * @param dto
    * @return
    */
    @Override
    public Page< ${className} > select${className}(Select${className}Dto dto){

    return mapper.select${className}(dto);
    }
</#if>

@Override
public  Map<Long, ${className}> getMap(List<Long> ids){
    Map<Long, ${className}> map = new HashMap<>();

    if (CollectionUtil.isNotEmpty(ids)) {
        List<${className}> list =listByIds(ids);
        if (CollectionUtil.isNotEmpty(list)) {
        map = list.stream().collect(Collectors.toMap(${className}::getId, pojo -> pojo));
         }
        }
        return map;
    }
}